package com.cobo.fitness.web.core;

import com.cobo.common.core.R;
import com.cobo.fitness.core.SpringContextUtils;
import com.cobo.fitness.web.DbService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

@RestController
public class CoreController {

    @Autowired
    private DbService dbService;


    @GetMapping("/{entity}/list")
    public R list(@PathVariable("entity") String entity) {
        List<Map<String, Object>> list = dbService.list(SqlUtils.list(entity));
        return R.ok(list);
    }
}
